package service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repository.PersonRepository;

import javax.transaction.Transactional;
import java.sql.SQLException;

/**
 * @program: springbootjpa-01
 * @description:
 * @author: Mr.Dai
 * @create: 2020-01-01 14:06
 **/
@Service
public class PersonService {
    private PersonRepository personRepository;
    @Autowired
    public void setPersonRepository(PersonRepository personRepository) {
        this.personRepository = personRepository;
    }
    @Transactional(rollbackOn = SQLException.class,value = Transactional.TxType.REQUIRES_NEW)
    public void updatePersonByEmail(String email, Integer id){
        personRepository.updatePersonByEmail(email, id);
    }
}
